#  Name:		proc-users-load
#  Version:     0.6
#  Part Of:		linuxrules
#  Modified:	Tue Dec 28 2010, 13:34:00

#  See COPYING for linuxrules GPL3 licensing info.

BEGIN {
     _proc["USERS"] = 0
	getline < "/proc/loadavg"
    _proc["LOAD"] = "'" $1 " " $2 " " $3 "'"
    _proc["RUNNING"] = $4
    _proc["TOTAL"] = $5
	_proc["LOAD_LAST"] = $1
    close("/proc/loadavg")

# TODO FIXME this tags do not make sense
# they should be more clear
    _proc["USERID"]  = "'"
    _proc["USREF"]  = "'"
    _proc["USERKEY"]  = "'"
    
	while(getline < "/proc/key-users")
    {
        _proc["USERS"] += 1
        _proc["USERID"]  = $1 " " _proc["USERID"]
        _proc["USREF"]  = $2 " " _proc["USREF"]
        _proc["USERKEY"]  = $3 " " _proc["USERKEY"]
    }
    close("/proc/key-users")

    gsub( ":", "", _proc["USERID"])

    _proc["USERID"]  = "'" _proc["USERID"]
    _proc["USREF"]  = "'" _proc["USREF"]
    _proc["USERKEY"]  = "'" _proc["USERKEY"]

    sub( " '", "'", _proc["USERID"])
    sub( " '", "'", _proc["USREF"])
    sub( " '", "'", _proc["USERKEY"])
}

# vim:ft=awk:
